<template>
    <div class="answer-statistics">
        <div class="header">
            <img src="../../static/images/sub-status.png" alt="">
            <div class="right">
                <div class="examTime">考试剩余时间：</div>
                <div class="number">机号：
                    <span class="r-c">1</span>
                </div>
            </div>
        </div>
        <div class="status-wrap">
            <div class="title">
                <i style="margin-right: 30px;">
                    已答试题
                    <span>{{makedCount}}</span>题
                </i>
                <i>
                    未答试题
                    <span class="c-orange">{{unMakedCount}}</span>题
                </i>
            </div>
            <div class="box-wrap">
                <!--  -->
                <table class="table-status" v-for="(type,idx) in typeList">
                    <caption>{{numToHanzi(idx)}}、{{qusTypeToName(type+'')}}</caption>
                    <thead>
                        <tr>
                            <th>试题编号</th>
                            <th>答题状态</th>
                            <th>试题浏览次数</th>
                        </tr>
                    </thead>
                    <tbody>
                        <template v-for="(qus,num) in qusList">
                            <tr v-if="qus.type==type">
                                <td>{{qus.num}}</td>
                                <td>
                                    <span class="c-green">{{qus.finished?'已答':'未答'}}</span>
                                </td>
                                <td>{{qus.browseCount>0?qus.browseCount:0}}</td>
                            </tr>
                        </template>
                    </tbody>
                </table>
               
                
            </div>
            <div class="backExamList">
                <img @click="backExamList" src="../../static/images/btn-goback-s.png" alt="">
            </div>
        </div>
    </div>
</template>
<script>
export default {
  name: "answerStatistics",
  props: ["qusList","typeList"],
  data() {
    return {
      makedCount: 0,
      unMakedCount: 0
    };
  },
  created() {
    
  },
  mounted(){
    console.log(this.qusList);
  },
  methods: {
      numToHanzi(num){//数字转汉字
      switch(num){
        case 0:
          return '一';break;
        case 1:
          return '二';break;
        case 2:
          return '三';break;
        case 3:
          return '四';break;
      }
    },
    qusTypeToName(type){//题型转为类型
      switch(type){
        case '0':
          return '单项选择题';break;
        case '1':
          return '多项选择题';break;
        case '4':
          return '简答题';break;
        case '5':
          return '计算分析题';break;
        case '6':
          return '综合题';break;
        case '7':
          return '计算问答题';break;
        case '8':
          return '案例分析题';break; 
      }
    },
    backExamList() {
      //返回答题列表
      this.$emit("close");
    }
  }
};
</script>

<style lang="scss" scoped>
.answer-statistics {
  //作答情况统计
  font-size: 14px;
  position: absolute;
  left: 0;
  right: 0;
  margin: 0 auto;
  padding: 0 8px;
  width: 1022px;
  border: 1px solid #c1cee3;
  height: 766px;
  background: url(../../static/images/bg-2.jpg);
  .c-orange {
    color: #ff8a53;
  }
  .header {
    width: 100%;
    text-align: center;
    font-weight: bold;
    padding-top: 10px;
    .right {
      position: absolute;
      right: 10px;
      top: 36px;
      display: flex;
      font-size: 14px;
      align-items: flex-end;
      .examTime {
        padding-right: 80px;
        display: flex;
      }
    }
  }
  // 主体
  .status-wrap {
    .title {
      height: 26px;
      text-align: right;
      margin: 0 auto 0px;
      z-index: 1;
      position: relative;
      padding: 10px 20px;
      width: 980px;
      border: 1px solid #d7e8fa;
      background-color: #fff;
      background: url(../../static/images/ColumnBg.gif) repeat-x;
      font-weight: bold;
      i {
        font-style: normal;
      }
    }
    .box-wrap {
      border: 1px solid #d7e8fa;
      width: 980px;
      max-height: 570px;
      min-height: 300px;
      background-color: #f5fafe;
      border-radius: 10px;
      box-shadow: 3px 3px 10px #666;
      margin: 0 auto;
      padding-bottom: 20px;
      -webkit-overflow-scrolling: touch;
      overflow-y: auto;

      .table-status {
        width: 90%;
        margin: 20px auto;

        caption {
          font-weight: bold;
          margin: 5px 0;
        }
        caption,
        th {
          text-align: left;
        }
        th {
          background-color: #74a0c7;
          color: #fff;
          border: 1px solid #ccc;
        }
        th,
        td {
          border: 1px solid #ccc;
          padding: 5px 20px;
          text-align: center;
        }
      }
    }
  }
  .backExamList {
    margin-top: 30px;
    text-align: right;
    img {
      cursor: pointer;
    }
  }
}
</style>

